﻿using UnityEngine;

namespace DL.Combat.Base.Data
{
    /// <summary>
    /// 角色攻击动作信息
    /// </summary>
    [CreateAssetMenu(menuName = "GameData/Assets/Combat/CombatAction",fileName = "New CombatAction",order = 0)]
    public class CombatActionSO : ScriptableObject
    {
        //1.动作名称
        //2.受伤动画
        //3.格挡动画
        //4.攻击角度
        //5.攻击半径
        //6.伤害值
        //7.攻击间隔时间
        //8.匹配位置
        //9.是否需要匹配
        //10.动画混合时间
        //11.动画偏移量
        //12.下一招式
        [SerializeField] private string _comboActionName;
        [SerializeField] private string[] _comboHitName;
        [SerializeField] private string[] _comboParryName;
        [SerializeField] private float[] _actionAngle;
        [SerializeField] private float[] _actionDistance;
        [SerializeField] private float[] _actionDamage;
        [SerializeField] private float _actionColdTime;
        [SerializeField] private float _animationMatchOffset;
        [SerializeField] private bool _animationMatch;
        [SerializeField] private float _animationNormalTime;
        [SerializeField] private float _animationOffset;
        [SerializeField] private CombatActionSO _nextCombatActionSo;
    
        public string ComboActionName => _comboActionName;
        public string[] ComboHitName => _comboHitName;
        public string[] ComboParryName => _comboParryName;
        public float[] AactionAngle => _actionAngle;
        public float[] ActionDistance => _actionDistance;
        public float[] ActionDamage => _actionDamage;
        public float ActionColdTime => _actionColdTime;
        
        public float AnimationMatchOffset => _animationMatchOffset;
        public float AnimationNormalTime => _animationNormalTime;
        public float AnimationOffset => _animationOffset;
        public bool AnimationMath => _animationMatch;
        public CombatActionSO NextCombatAction => _nextCombatActionSo;

        /// <summary>
        /// 最大长度
        /// </summary>
        public int MaxHitCount;
        
        //递归初始化各个执行表
        public void Init()
        {
            if (_nextCombatActionSo != null)
            {
                _nextCombatActionSo.Init();
            }

            MaxHitCount = _comboHitName.Length;
        }
    }
}